/*
 * Copyright (C), 2015-2018
 * FileName: BeanFactory
 * Author:   zhao
 * Date:     2018/11/9 19:07
 * Description: bean工厂--用来存放、注册、获取bean
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.lizhaoblog.tinyspring;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 〈一句话功能简述〉<br>
 * 〈bean工厂--用来存放、注册、获取bean〉
 *
 * @author zhao
 * @date 2018/11/9 19:07
 * @since 1.0.1
 */
public class BeanFactory {
    private Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<>();

    public Object getBean(String name) {
        return beanDefinitionMap.get(name).getBean();
    }

    public void registerBeanDefinition(String name, BeanDefinition beanDefinition) {
        beanDefinitionMap.put(name, beanDefinition);
    }

}
